import com.dd.config.SpringConfig;
import com.dd.dao.BaseDao;
import com.dd.dao.BookDao;
import com.dd.dao.StuDao;
import com.dd.service.BookService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import javax.sql.DataSource;

public class App {
    public static void main(String[] args) {
        //创建Spring容器
        ApplicationContext ctx = new AnnotationConfigApplicationContext(SpringConfig.class);
//        BaseDao baseDao = ctx.getBean(BaseDao.class);
//        baseDao.showBase();

//        StuDao stuDao = ctx.getBean(StuDao.class);
//        stuDao.showStu();

        DataSource dataSource = ctx.getBean(DataSource.class);
        System.out.println(dataSource);

        BookDao bookDao = ctx.getBean(BookDao.class);
        bookDao.getBook();

        BookService bookService = ctx.getBean(BookService.class);
        bookService.getBook();
    }
}
